import { HttpResponseData, httpData } from '@/utils/types';
import { get, post } from '@/utils/request';

/**
 * 物料调拨
 */
/**
 * 分页
 */
export function getList(data?: httpData) {
    return get('/warehouse/move/list', data);
}

/**
 * 删除单据
 */
export function deleteBatch(data?: httpData) {
    return post('/warehouse/move/deleteBatch', data);
}
export interface WarehouseMoveDto {
    inWarehouseId?: string;
    inWarehouseNum?: string;
    type?: number;
}

/**
 * 新增调拨单
 */
export function saveDocument(data?: WarehouseMoveDto) {
    return post('/warehouse/move/save', data);
}

export interface ScanWarehouseDto {
    warehouseId?: string;
    warehouseLocationNum?: string;
}

export interface WarehouseLocationInfo {
    addTime?: string;
    companyId?: string;
    editTime?: string;
    id?: string;
    locationCode?: string;
    locationExplain?: string;
    locationNum?: string;
    operatorId?: string;
    operatorName?: string;
    remark?: string;
    warehouseId?: string;
    warehouseName?: string;
    warehouseNum?: string;
}

/**
 * 库位扫码
 */
export function scanWarehouseLocation(
    data?: ScanWarehouseDto
): Promise<HttpResponseData<WarehouseLocationInfo> | null> {
    return get('/warehouse/location/getWarehouseLocation', data);
}

export interface ScanCylinderInfo {
    cylinderCode: string;
    warehouseMoveId: string;
}

/**
 * 气瓶扫码
 */
export function scanCylinder(data?: ScanCylinderInfo): Promise<any> {
    return get('/warehouse/move/cylinder/relate/scan', data);
}

/**
 * 调拨提交
 */
export function submit(data?: any): Promise<any> {
    return post('/warehouse/move/cylinder/relate/save', data);
}
